home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2007 September / PCWSEP07.iso / Software / Linux / Linux Mint 3.0 Light / LinuxMint-3.0-Light.iso / casper / filesystem.squashfs / var / lib / dpkg / info / hplip.postinst < prev    next >
Encoding:
Text File  |  2007-04-04  |  3.8 KB  |  122 lines

  1. #! /bin/sh
  2. # postinst script for hplip
  3. # $Id: hplip.postinst,v 1.1 2005/10/15 21:39:04 hmh Exp $
  4. #
  5. # see: dh_installdeb(1)
  6.  
  7. set -e
  8.  
  9. # summary of how this script can be called:
  10. #        * <postinst> `configure' <most-recently-configured-version>
  11. #        * <old-postinst> `abort-upgrade' <new version>
  12. #        * <conflictor's-postinst> `abort-remove' `in-favour' <package>
  13. #          <new-version>
  14. #        * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
  15. #          <failed-install-package> <version> `removing'
  16. #          <conflicting-package> <version>
  17. # for details, see http://www.debian.org/doc/debian-policy/ or
  18. # the debian-policy package
  19. #
  20. # quoting from the policy:
  21. #     Any necessary prompting should almost always be confined to the
  22. #     post-installation script, and should be protected with a conditional
  23. #     so that unnecessary prompting doesn't happen if a package's
  24. #     installation fails and the `postinst' is called with `abort-upgrade',
  25. #     `abort-remove' or `abort-deconfigure'.
  26.  
  27. case "$1" in
  28.     configure)
  29.     # add hplip system user (requires adduser >= 3.34)
  30.     # don't muck around with this unless you KNOW what you're doing
  31.     echo "Creating/updating hplip user account..."
  32.     adduser --system --ingroup lp --home /var/run/hplip \
  33.         --gecos "HPLIP system user" --shell /bin/false \
  34.         --quiet --disabled-password hplip || {
  35.       # adduser failed. Why?
  36.       if getent passwd hplip >/dev/null ; then
  37.          echo "Non-system user hplip found. I will not overwrite a non-system" >&2
  38.          echo "user.  Remove the user and reinstall hplip." >&2
  39.          exit 1
  40.       fi
  41.       # unknown adduser error, simply exit
  42.       exit 1
  43.     }
  44.     if getent group scanner >/dev/null; then
  45.         adduser --quiet hplip scanner
  46.     else
  47.         addgroup --quiet --system scanner
  48.         adduser --quiet hplip scanner
  49.     fi
  50.  
  51.     for i in /var/run/hplip
  52.     do
  53.         if ! dpkg-statoverride --list $i > /dev/null
  54.         then
  55.             dpkg-statoverride --update --add hplip root 755 $i
  56.         fi
  57.     done
  58.  
  59.  
  60.     # Remove shutdown and reboot links; this init script does not need them.
  61.     if dpkg --compare-versions "$2" lt "0.9.11-2ubuntu3"; then
  62.         rm -f /etc/rc0.d/K19hplip /etc/rc6.d/K19hplip
  63.     fi
  64.  
  65.     # Correct ownership of personal HPLIP config files of the users
  66.     # (in older HPLIP versions hp-setup created these files with root
  67.     #  permissions and made hp-toolbox crashing)
  68.     for line in `cat /etc/passwd | sed -e 's/ //g'`; do 
  69.         user=`echo $line | cut -d : -f 1`;
  70.         homedir=`echo $line | cut -d : -f 6`;
  71.         [ -d $homedir ] && \
  72.             find $homedir -maxdepth 1 -not -user $user -name .hplip* \
  73.             -exec chown $user '{}' \; 2>/dev/null || :
  74.     done
  75.     ;;
  76.  
  77.     abort-upgrade|abort-remove|abort-deconfigure)
  78.     ;;
  79.  
  80.     *)
  81.         echo "postinst called with unknown argument \`$1'" >&2
  82.         exit 1
  83.     ;;
  84. esac
  85.  
  86. # dh_installdeb will replace this with shell code automatically
  87. # generated by other debhelper scripts.
  88.  
  89. # Automatically added by dh_installmenu
  90. if [ "$1" = "configure" ] && [ -x "`which update-menus 2>/dev/null`" ]; then
  91.     update-menus
  92. fi
  93. # End automatically added section
  94. # Automatically added by dh_desktop
  95. if [ "$1" = "configure" ] && which update-desktop-database >/dev/null 2>&1 ; then
  96.     update-desktop-database -q
  97. fi
  98. # End automatically added section
  99. # Automatically added by dh_pysupport
  100. if [ "$1" = "configure" ] && which update-python-modules >/dev/null 2>&1; then
  101.     update-python-modules -i /usr/share/python-support/hplip
  102. fi
  103. # End automatically added section
  104. # Automatically added by dh_pysupport
  105. if [ "$1" = "configure" ] && which update-python-modules >/dev/null 2>&1; then
  106.     update-python-modules -b hplip.dirs
  107. fi
  108. # End automatically added section
  109. # Automatically added by dh_installinit
  110. if [ -x "/etc/init.d/hplip" ]; then
  111.     update-rc.d hplip defaults 19 >/dev/null
  112.     if [ -x "`which invoke-rc.d 2>/dev/null`" ]; then
  113.         invoke-rc.d hplip start || exit $?
  114.     else
  115.         /etc/init.d/hplip start || exit $?
  116.     fi
  117. fi
  118. # End automatically added section
  119.  
  120.  
  121. exit 0
  122.